#include "LKH.h"

//static int GenerateRnd(int Dimension);

float ChooseADDK()
{
	int i;
	float llx, MaxMinLx;

	MaxMinLx = 0;

	if (SubproblemSize == 0)
        FirstNode = &NodeSet[1 + GenerateRnd()%Dimension];
    else {
            int i;
            for (i = GenerateRnd()%Dimension ; i > 0; i--)
                FirstNode = FirstNode->Suc;
    }
//	printff("addk firstnod = %d\n",FirstNode->Id);

	ChooseInitialTour();
	BetterCost = OriginalLinKernighan();
	RecordBetterTour();
	TransArray(BetterTour,&BetterArray);

	for( i = 0; i < Dimension; i++ )
	{
		ChooseInitialTour();
		llx = SearchMinLx();
		if( llx > MaxMinLx )
			MaxMinLx = llx;
	}

	return MaxMinLx;
}
